package com.justgame.project.service.system.service.basic;

import com.justgame.project.service.system.entity.SysStationOrder;
import com.justgame.project.service.system.query.SysStationOrderQuery;
import com.justgame.project.service.system.wrapper.SysStationOrderWrapper;
import com.justgame.project.base.servcice.IBasicService;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.lang.Integer;
import org.springframework.lang.NonNull;
import java.lang.String;
import java.math.BigDecimal;

/**
 *
 * 平台站内订单服务自定义查询类
 *
 * @@tableName sys_station_order
 * @author Zwb
 */
@SuppressWarnings("all")
public interface BasicSysStationOrderService extends IBasicService<SysStationOrderQuery,SysStationOrder,SysStationOrderWrapper> {

   /**
    * 新增创建
    * @param gameInfoId 游戏信息
    * @param costCoins 购买消耗金币
    * @param beforePaidCoins 支付前拥有金币
    * @param expireDate 订单支付过期时间
    * @param orderNo 订单编号
    * @param costIntegral 购买消耗积分
    * @param beforePaidIntegral 支付前拥有积分
    * @param remark 备注
    */
   default SysStationOrder baseAdd(Integer gameInfoId, BigDecimal costCoins, BigDecimal beforePaidCoins, LocalDateTime expireDate, String orderNo, BigDecimal costIntegral, BigDecimal beforePaidIntegral, String remark){
      SysStationOrder sysStationOrder = new SysStationOrder();
      sysStationOrder.setGameInfoId(safeValue(gameInfoId, null));
      sysStationOrder.setCostCoins(safeValue(costCoins, null));
      sysStationOrder.setBeforePaidCoins(safeValue(beforePaidCoins, null));
      sysStationOrder.setExpireDate(safeValue(expireDate, null));
      sysStationOrder.setOrderNo(safeValue(orderNo, null));
      sysStationOrder.setCostIntegral(safeValue(costIntegral, null));
      sysStationOrder.setBeforePaidIntegral(safeValue(beforePaidIntegral, null));
      sysStationOrder.setRemark(safeValue(remark, null));
      save(sysStationOrder);
      return sysStationOrder;
   }

   /**
    * 更新
    * @param gameInfoId 游戏信息
    * @param costCoins 购买消耗金币
    * @param beforePaidCoins 支付前拥有金币
    * @param expireDate 订单支付过期时间
    * @param orderNo 订单编号
    * @param costIntegral 购买消耗积分
    * @param beforePaidIntegral 支付前拥有积分
    * @param remark 备注
    */
   default boolean baseUpdate(@NonNull SysStationOrder sysStationOrder,Integer gameInfoId, BigDecimal costCoins, BigDecimal beforePaidCoins, LocalDateTime expireDate, String orderNo, BigDecimal costIntegral, BigDecimal beforePaidIntegral, String remark){
      Assert.notNull(expireDate,"必须提供订单支付过期时间");
      Assert.notNull(costIntegral,"必须提供购买消耗积分");
      Assert.notNull(costCoins,"必须提供购买消耗金币");
      Assert.notNull(beforePaidIntegral,"必须提供支付前拥有积分");
      Assert.notNull(remark,"必须提供备注");
      Assert.notNull(gameInfoId,"必须提供游戏信息");
      Assert.notNull(beforePaidCoins,"必须提供支付前拥有金币");
      Assert.notNull(orderNo,"必须提供订单编号");
      Assert.notNull(sysStationOrder.getId(),"必须提供主键ID");
      sysStationOrder.setGameInfoId(safeValue(gameInfoId, null));
      sysStationOrder.setCostCoins(safeValue(costCoins, null));
      sysStationOrder.setBeforePaidCoins(safeValue(beforePaidCoins, null));
      sysStationOrder.setExpireDate(safeValue(expireDate, null));
      sysStationOrder.setOrderNo(safeValue(orderNo, null));
      sysStationOrder.setCostIntegral(safeValue(costIntegral, null));
      sysStationOrder.setBeforePaidIntegral(safeValue(beforePaidIntegral, null));
      sysStationOrder.setRemark(safeValue(remark, null));
      return updateById(sysStationOrder);
   }

}